Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASoC: Intel: cht_bsw_rt5672: check return value #4698

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

aiChaoSONG
Copy link
Collaborator

Set codec sysclk could fail and return error, add
error check for it.

Set codec sysclk could fail and return error, add
error check for it.

Signed-off-by: Chao Song <[email protected]>
if (ret < 0) {
dev_err(card->dev, "failed to set codec sysclk: %d\n", ret);
return ret;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we still do the clk_disable_unprepare() even in error case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, there's other calls to snd_soc_dai_set_sysclk() in the same file and in other drivers, none of them call clk_disable_unprepare() on failure. All just print and return error.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ujfalusi @aiChaoSONG I think clk_disable_unprepare() is still needed when snd_soc_dai_set_sysclk() return error.
Turn on/off the clock is the main purpose of platform_clock_control().

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a similar behavior in two other machine drivers:

		ret = snd_soc_dai_set_sysclk(codec_dai, RT5640_SCLK_S_RCCLK,
					     48000 * 512,
					     SND_SOC_CLOCK_IN);
		if (!ret)
			clk_disable_unprepare(priv->mclk);
               ret = snd_soc_dai_set_sysclk(codec_dai, RT5645_SCLK_S_RCCLK,
					48000 * 512, SND_SOC_CLOCK_IN);
		if (ret < 0) {
			dev_err(card->dev, "can't set codec sysclk: %d\n", ret);
			return ret;
		}

		clk_disable_unprepare(ctx->mclk);

so I vote to align and think later if this makes sense.

@bardliao bardliao merged commit 39e7681 into thesofproject:topic/sof-dev Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants